/* ===== index ===== ：首页*/
myApp.onPageInit('index', function (page) {
	console.log('index');
	//导航栏
	$$('#index_span_city').html(global_city);
    // 初始化
	$$.ajax({
        url:url_get_index,
        data: {
            cityId:global_cityid
        }, 
        method:"GET",
        dataType:"json",
        // cache:false,
        // crossDomain:true,
        // async:false,
        success:function (ajaxresult) {
    		if(ajaxresult.code==1){
    			var _maindata = ajaxresult.data;
                console.log(_maindata);
    			var data_indexbanner = _maindata.banner;
    			var data_new_playitem = _maindata.newlinelist;
    			var data_hot_playitem = _maindata.poplinelist;
    			var data_self_playitem = _maindata.ziying;
                //banner
    			var html_indexbanner = myApp.indexBannerTemplate(data_indexbanner);
        		$$('#index .banner').html(html_indexbanner);
    			
    			var bannerswiper=new Swiper ('#index .swiper-index_banner', {
    		    	loop: true,
    		    	pagination:'.swiper-pagination-index_banner',
    		    	autoplay:5000,
    			    autoplayDisableOnInteraction:false
    		    });
                // 新玩法
    			var html_new_playitem = myApp.indexplayItemTemplate(data_new_playitem);
        		$$('#index .new_playitem').html(html_new_playitem);
        		
        		var newplayswiper=new Swiper ('#index .swiper-index_new_playitem', {
                    loop: true,
                    pagination:'.swiper-pagination-index_new_playitem',
                    autoplay:5000,
            	    autoplayDisableOnInteraction:false
                });
        		//热门玩法
        		var html_hot_playitem = myApp.playItemTemplate(data_hot_playitem);
        		$$('#index .hot_playitem').html(html_hot_playitem);
        		//自营列表
        		var html_self_playitem = myApp.playSelfItemTemplate(data_self_playitem);
        		$$('#index .self_playitem').html(html_self_playitem);
        		
    		}else{
    			ajaxfail(ajaxresult.msg);
    		}
    	},
    });
});